<div class="home_box" style="padding: 10px;">
    <div style="display: none">
        <input type="hidden" id="operationTime" value="">
    </div>
    <div class="chargeBtn" style="display: flex;">
        <button type="button" class="btn">账单记录</button>
        <button type="button" class="btn">支付记录</button>
        @if(shiro.hasPermission("/operation_no")){
        <button type="button" class="btn">收欠款</button>
        @}
        @if(shiro.hasPermission("/execution_records")){
        <button type="button" class="btn">执行记录</button>
        @}
    </div>
    <div class="chargeContent">
        <!-- 账单记录 -->
        <div>
            <div style="display: flex;padding: 10px 0">
                <div style="flex: 1">
                    <span>已收费</span>
                    <span><label><input style="vertical-align: sub;" class="dealCheck" id="settleCheck"
                                        checked="checked" type="checkbox">结清</label></span>
                    <span><label><input style="vertical-align: sub;" class="dealCheck" id="refundCheck"
                                        checked="checked" type="checkbox">退款</label></span>
                    <span><label><input style="vertical-align: sub;" class="dealCheck" id="arrearsCheck"
                                        checked="checked" type="checkbox">欠费</label></span>
                    <span><label><input style="vertical-align: sub;" class="dealCheck" id="deductionCheck"
                                        checked="checked" type="checkbox">抵扣</label></span>
                    <span style="margin-left: 10px;font-weight: bold;">实收总额 <span style="font-size: 16px;">${totalPayDealActualPay}</span></span>
                    <span style="margin-left: 10px;font-weight: bold;">欠费总额 <span style="font-size: 16px;color: red">${totalPayDealArrears}</span></span>
                </div>
                <div class="chargeBtn" style="text-align: right">
                </div>
            </div>
            <div style="border-bottom: 2px solid #ff7e00;border-top: 2px solid #ff7e00;">
                <div style="display: flex;padding: 6px 0;border-bottom: 1px solid #ff7e00;color: #666a73;text-align: center">
                    <div style="flex: 1;">展开</div>
                    <div style="flex: 1;">操作诊所</div>
                    <div style="flex: 1;">单据号</div>
                    <div style="flex: 2;">首次收费时间</div>
                    <div style="flex: 1;">账单状态</div>
                    <div style="flex: 1;">医生</div>
                    <div style="flex: 1;">护士</div>
                    <div style="flex: 1;">TC</div>
                    <div style="flex: 1;">应收</div>
                    <div style="flex: 1;">实收</div>
                    <div style="flex: 1;">优惠抵扣</div>
                    <div style="flex: 1;">欠费汇总</div>
                    <div style="flex: 2;">备注</div>
                    <div style="flex: 2.5;">操作</div>
                </div>
                <div id="orderhtml">
                    @for(custDeal in custDealList){
                    <div class="order">
                        <div style="display: flex;text-align: center;border-bottom: 1px solid #DDDDDD;padding: 5px 0">
                            <div style="flex: 1;" class="showDetail" onclick="showDetail(this)">
                                <span class="glyphicon glyphicon-collapse-down"></span>
                                <span class="glyphicon glyphicon-collapse-up" style="display: none"></span>
                            </div>
                            <div style="flex: 1;">${custDeal.outpatientName}</div>
                            <div style="flex: 1;">${custDeal.documentNumber}</div>
                            <div style="flex: 2;" class="beyond" title="${custDeal.operationTime}">${custDeal.operationTime}</div>
                            <div style="flex: 1;">${custDeal.dealStatus}</div>
                            <div style="flex: 1;" class="beyond" title="${custDeal.doctor}">${custDeal.doctor}</div>
                            <div style="flex: 1">${custDeal.nurse}</div>
                            <div style="flex: 1;">${custDeal.tcName}</div>
                            <div style="flex: 1;">${custDeal.foldingPay}</div>
                            <div style="flex: 1;">${custDeal.serviceActualPay+custDeal.depositAmount}</div>
                            <div style="flex: 1;">${custDeal.deductionAmount}</div>
                            <div class="dealArrears" style="flex: 1;">${custDeal.arrears}</div>
                            <div style="flex: 2;" class="beyond" title="${custDeal.remarks}">${custDeal.remarks}</div>
                            <div class="dealDeductionAmount" style="display: none">${custDeal.deductionAmount}</div>
                            <div style="flex: 2.5;">
                                <span><a href="javascript:;" onclick="openingDetails('${custDeal.operationTime}','${custDeal.outpatientName}')">首次开单详情</a></span>
                                <span><a href="javascript:;" onclick="detailsPrint('${custDeal.operationTime}','${custDeal.outpatientName}')">打印</a></span>
                                <span><a href="javascript:;" onclick="refundTotal('${custDeal.operationTime}','${custDeal.serviceActualPay}','${custDeal.depositAmount}','${custDeal.outpatientName}','${custDeal.tcName}')">退款</a></span>
                                @if(shiro.hasPermission("/changeDoctorAuthority")){
                                <span><a href="javascript:;" onclick="updateAchievement('${custDeal.operationTime}','${custDeal.outpatientName}')">变更医生</a></span>
                                @}
                            </div>
                        </div>
                        <div style="padding: 15px 20px;overflow: hidden;display: none">
                            <div class="dealInfoList"
                                 style="box-shadow: 0 0 8px #cccccc;border-radius: 6px;overflow: hidden;">
                                <div style="display: flex;padding: 4px 0;background: #fec182;color: #666a73;text-align: center">
                                    <div style="flex: 1;">操作诊所</div>
                                    <div style="flex: 2;">交易时间</div>
                                    <div style="flex: 1;">交易类型</div>
                                    <div style="flex: 1;">交易状态</div>
                                    <div style="flex: 1;">收费人</div>
                                    <div style="flex: 1;">医生</div>
                                    <div style="flex: 1;">护士</div>
                                    <div style="flex: 1;">实收</div>
                                    <div style="flex: 1;">优惠抵扣</div>
                                    <div style="flex: 1.5;">收费方式</div>
                                    <div style="flex: 2;">备注</div>
                                    <div style="flex: 2.5;">操作</div>
                                </div>
                                @for(dealInfo in custDeal.dealList){
                                <div class="openOrder" style="display: flex;padding: 7px 0;border-top: 1px solid #eeeeee;text-align: center;">
                                    <div style="flex: 1;">${dealInfo.outpatientName}</div>
                                    <div style="flex: 2;">${dealInfo.getTime}</div>
                                    @if(dealInfo.isDo == 1){
                                    <div class="dealType" style="flex: 1;">储值划扣</div>
                                    @}
                                    @if(dealInfo.isDo == 2){
                                    <div class="dealType" style="flex: 1;">继续做</div>
                                    @}
                                    @if(dealInfo.isDo == 3){
                                    <div class="dealType" style="flex: 1;">还欠款</div>
                                    @}
                                    @if(dealInfo.isDo == 4){
                                    <div class="dealType" style="flex: 1;">退款</div>
                                    @}
                                    @if(dealInfo.isDo == 5){
                                    <div class="dealType" style="flex: 1;">消费</div>
                                    @}
                                    @if(dealInfo.isDo == 6){
                                    <div class="dealType" style="flex: 1;">作废</div>
                                    @}
                                    @if(dealInfo.dealStatus == '已开单'){
                                    <div style="flex: 1;">${dealInfo.dealStatus}</div>
                                    @}
                                    @if(dealInfo.dealStatus == '已结账'){
                                    <div style="flex: 1;">已结账</div>
                                    @}
                                    <div style="flex: 1;">${dealInfo.rechargePeople}</div>
                                    <div style="flex: 1;">${dealInfo.doctor}</div>
                                    <div style="flex: 1">${dealInfo.nurse}</div>
                                    <div style="flex: 1;" class="beyond" title="${dealInfo.serviceActualPay}元">
                                        ${dealInfo.serviceActualPay}元
                                    </div>
                                    <div style="flex: 1;" class="beyond" title="${dealInfo.deductionAmount}">
                                        ${dealInfo.deductionAmount}
                                    </div>
                                    <div style="flex: 1.5;" class="beyond" title="(${dealInfo.checkoutMethod})">
                                        (${dealInfo.checkoutMethod})
                                    </div>
                                    <div style="flex: 2;" class="beyond" title="${dealInfo.remarks}">
                                        ${dealInfo.remarks}
                                    </div>
                                    <div style="flex: 2.5">
                                        <a onclick="printingDeal('${dealInfo.operationTime}','${dealInfo.outpatientName}','${dealInfo.getTime}','${reservationsId}')">详情打印</a>
                                        @if(shiro.hasPermission("/changeDoctorAuthority")){
                                        <a onclick="updateDoctorDeal('${dealInfo.getTime}','${dealInfo.outpatientName}')">变更医生</a>
                                        @}
                                        <a onclick="updateRemarksDeal('${dealInfo.getTime}','${dealInfo.outpatientName}')">修改备注</a>
                                    </div>
                                </div>
                                @}
                            </div>
                        </div>
                    </div>
                    @}
                </div>
            </div>
        </div>
        <!-- 支付记录 -->
        <div style="display: none">
            <div style="padding: 10px 0;font-weight: bolder;">
                <span>支付记录</span>
                <span>实收总额 <span style="font-size: 16px;">${totalPayDealActualPay}</span></span>
                <span>欠费总额 <span style="font-size: 16px;color: red">${totalPayDealArrears}</span></span>
            </div>
            <div style="border-bottom: 2px solid #ff7e00">
                <div style="display: flex;border-bottom: 1px solid #ff7e00;border-top: 2px solid #ff7e00;padding: 5px;text-align: center;">
                    <div style="flex: 1">操作诊所</div>
                    <div style="flex: 2">交易时间</div>
                    <div style="flex: 1">交易类型</div>
                    <div style="flex: 1">交易状态</div>
                    <div style="flex: 1">收费人</div>
                    <div style="flex: 1">TC</div>
                    <div style="flex: 1">财务应收</div>
                    <div style="flex: 1">应收</div>
                    <div style="flex: 1">实收</div>
                    <div style="flex: 1">优惠抵扣</div>
                    <div style="flex: 1">欠费变动</div>
                    <div style="flex: 1">备注</div>
                </div>
                @for(payDeal in payDealList){
                <div style="display: flex;border-bottom: 1px solid #DDDDDD;padding: 5px;text-align: center;">
                    @if(payDeal.isDo == 3){
                    <div style="flex: 1">${payDeal.outpatientName}</div>
                    <div style="flex: 2">${payDeal.getTime}</div>
                    <div style="flex: 1;">还欠款</div>
                    <div style="flex: 1">${payDeal.dealStatus}</div>
                    <div style="flex: 1">${payDeal.rechargePeople}</div>
                    <div style="flex: 1">${payDeal.tcName}</div>
                    <div style="flex: 1">${payDeal.foldingPay-payDeal.deductionAmount}</div>
                    <div style="flex: 1">0.0</div>
                    <div style="flex: 1">${payDeal.serviceActualPay}</div>
                    <div style="flex: 1">${payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.arrears}</div>
                    <div style="flex: 1" class="beyond" title="${payDeal.remarks}">${payDeal.remarks}</div>
                    @}
                    @if(payDeal.isDo == 4){
                    <div style="flex: 1">${payDeal.outpatientName}</div>
                    <div style="flex: 2">${payDeal.getTime}</div>
                    <div style="flex: 1;">退款</div>
                    <div style="flex: 1">${payDeal.dealStatus}</div>
                    <div style="flex: 1">${payDeal.rechargePeople}</div>
                    <div style="flex: 1">${payDeal.tcName}</div>
                    <div style="flex: 1">${payDeal.serviceActualPay+payDeal.arrears}</div>
                    <div style="flex: 1">${payDeal.tkfoldingPay}</div>
                    <div style="flex: 1">${payDeal.serviceActualPay}</div>
                    <div style="flex: 1">${payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.arrears}</div>
                    <div style="flex: 1" class="beyond" title="${payDeal.remarks}">${payDeal.remarks}</div>
                    @}
                    @if(payDeal.isDo == 5){
                    <div style="flex: 1">${payDeal.outpatientName}</div>
                    <div style="flex: 2">${payDeal.getTime}</div>
                    <div style="flex: 1;">消费</div>
                    <div style="flex: 1">${payDeal.dealStatus}</div>
                    <div style="flex: 1">${payDeal.rechargePeople}</div>
                    <div style="flex: 1">${payDeal.tcName}</div>
                    <div style="flex: 1">${payDeal.foldingPay-payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.foldingPay}</div>
                    <div style="flex: 1">${payDeal.serviceActualPay+payDeal.depositAmount}</div>
                    <div style="flex: 1">${payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.arrears}</div>
                    <div style="flex: 1" class="beyond" title="${payDeal.remarks}">${payDeal.remarks}</div>
                    @}
                    @if(payDeal.isDo == 6){
                    <div style="flex: 1">${payDeal.outpatientName}</div>
                    <div style="flex: 2">${payDeal.getTime}</div>
                    <div style="flex: 1;">作废</div>
                    <div style="flex: 1">${payDeal.dealStatus}</div>
                    <div style="flex: 1">${payDeal.rechargePeople}</div>
                    <div style="flex: 1">${payDeal.tcName}</div>
                    <div style="flex: 1">${payDeal.foldingPay-payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.foldingPay}</div>
                    <div style="flex: 1">${payDeal.serviceActualPay}</div>
                    <div style="flex: 1">${payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.arrears}</div>
                    <div style="flex: 1" class="beyond" title="${payDeal.remarks}">${payDeal.remarks}</div>
                    @}
                </div>
                @}
            </div>
        </div>
        <!-- 收欠费 -->
        <div style="display: none">
            <div style="border-bottom: 2px solid #FF7E00;margin-top: 10px;">
                <div id="arrearsDeal2">
                    <div style="display: flex;border-bottom: 1px solid #FF7E00;border-top: 2px solid #FF7E00;padding: 5px;text-align: center;">
                        <div style="flex: 0.4"></div>
                        <div style="flex: 1">诊所</div>
                        <div style="flex: 1.2">首次收费时间</div>
                        <div style="flex: 2">欠费项目</div>
                        <div style="flex: 1">tc</div>
                        <div style="flex: 1">医生</div>
                        <div style="flex: 1;">护士</div>
                        <div style="flex: 1">应收</div>
                        <div style="flex: 1">实收</div>
                        <div style="flex: 1">优惠抵扣</div>
                        <div style="flex: 1">欠费</div>
                        <div style="flex: 1">备注</div>
                    </div>
                    @for(arrearsDeal in arrearsDealList){
                    <div class="arrearsDeal" style="display: flex;border-bottom: 1px solid #DDDDDD;padding: 5px;text-align: center;">
                        <div style="flex: 0.4"><input onclick="chooseArrearsDeal(this)" class="id" value="${arrearsDeal.operationTime}" type="radio" name="checkedres"></div>
                        <div class="arrearsOutpatientName" style="flex: 1">${arrearsDeal.outpatientName}</div>
                        <div style="flex: 1.3" class="beyond" title="${arrearsDeal.operationTime}">${arrearsDeal.operationTime}</div>
                        <div style="flex: 2" class="beyond" title="${arrearsDeal.payServiceName}">${arrearsDeal.payServiceName}</div>
                        <div style="flex: 1" class="atcName">${arrearsDeal.tcName}</div>
                        <div style="flex: 1">${arrearsDeal.doctor}</div>
                        <div style="flex: 1">${arrearsDeal.nurse}</div>
                        <div style="flex: 1">${arrearsDeal.foldingPay}</div>
                        <div style="flex: 1">${arrearsDeal.serviceActualPay}</div>
                        <div style="flex: 1">${arrearsDeal.deductionAmount}</div>
                        <div style="flex: 1" class="arrears">${arrearsDeal.arrears}</div>
                        <div style="flex: 1" class="beyond" title="${arrearsDeal.remarks}">${arrearsDeal.remarks}</div>
                    </div>
                    @}
                </div>
                <div style="text-align: right;padding: 10px 0;color: #FF7E00;font-size: 14px;font-weight: bolder;border-top: 1px solid #FF7E00">
                    <span>总计应收</span>
                    <span id="totalArrearsAmount">${totalArrearsAmount}</span>
                </div>
            </div>
            <div>
                <div style="margin-top: 10px;width: 560px;background: #f4f4f4;border-radius: 3px;padding: 7px 15px;display:flex" >
                    <label style="flex: 1;" for="earnests">
                        <input type="checkbox" id="earnests" value="储值划扣" style="vertical-align: middle">
                        <span style="vertical-align: sub;">储值余额<span id="moneyBalance2" style="margin-left: 10px;">
                            ${khmoneyBalance}</span></span>
                    </label>
                    <label style="flex: 1" for="integrals">
                        <input type="checkbox" id="integrals" value="使用返现" style="vertical-align: middle">
                        <span style="vertical-align: sub;">使用返现/优惠券可抵扣金额<span id="jfbalance2" style="margin-left: 10px;">
                            ${khjfbalance}</span></span>
                    </label>
                </div>
                <div id="inquireAboutBox" style="border-top: 2px solid #ff7e00;border-bottom: 2px solid #ff7e00;margin: 10px 0;display: none">
                    <div style="border-bottom: 1px solid #ff7e00;display: flex;padding: 5px 0;text-align: center;">
                        <div style="flex: 2;padding-left: 5px;text-align: left">项目名称</div>
                        <div style="flex: 0.5">单价</div>
                        <div style="flex: 0.5">数量</div>
                        <div style="flex: 0.5">欠款</div>
                        <div style="flex: 1;display: none" class="deduction2">划扣储值</div>
                        <div style="flex: 1;display: none" class="application2">抵用方式</div>
                        <div style="flex: 1;display: none" class="sumMoney2">抵用金额</div>
                    </div>
                    <div id="inquireAbout"></div>
                </div>
                <div style="background: #f4f4f4;padding: 7px 15px;display: flex;border-radius: 3px;overflow: hidden;margin-top: 10px;">
                    <div style="display: flex;background: white;padding: 4px 12px;border-radius: 3px;font-weight: bolder;">
                        <div><span>总欠款：</span><span id="chooseDealArrears" style="font-size: 16px;color: red;">0.00</span></div>
                    </div>
                    <div style="padding-left: 30px;line-height: 30px;">
                        <span>支付金额：</span>
                        <input id="arrearsAmount" autocomplete="off" style="width: 60%;height: 30px;margin-left: 5px;padding-left: 5px;"
                               type="text" oninput="decimalNum(this),changeAmount()" value="0">
                    </div>
                </div>
                <div style="background: #f4f4f4;margin-top: 10px;padding:10px 15px;border-radius: 3px;overflow: hidden;">
                    <div>
                        <span style="width: 80px;display: inline-block;text-align: right;font-weight: bolder">开单tc：</span>
                        <select name="aTcName" id="aTcName" style="padding-left: 5px;height: 28px;width: 120px;">
                            <option value="">请选择</option>
                            @for(str in tcList){
                            <option value="${str.tcName}">${str.tcName}</option>
                            @}
                        </select>
                    </div>
                    <div style="margin-top: 10px;">
                        <span style="width: 80px;display: inline-block;vertical-align: top;text-align: right;font-weight: bolder">备注：</span>
                        <textarea id="arrearsRemark" style="height: 60px;width: 35%;padding-left: 5px;"></textarea>
                    </div>
                </div>
                <div style="margin-top: 10px;">
                    <div style="text-align:center">
                        <button onclick="repairArrears()" type="button" class="btn btnStyle" style="background: #FF7E00;color: white">提交</button>
                        <button onclick="parent.layer.close(parent.layer.getFrameIndex(window.name))" type="button" class="btn btnStyle">关闭</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- 执行记录 -->
        <div style="display: none;padding: 10px 0;">
            <div style="text-align: center;border-top: 3px solid #ff7e00;border-bottom: 3px solid #ff7e00;">
                <#doctor_seeDiagnosisf1 id="doctor_seeDiagnosisf" list="${payServiceInfoList1}"/>
            </div>
        </div>
    </div>
</div>
<script src="${ctxPath}/static/modular/tcCenter/consultant/consultant_chargeDetails.js?v=20200718"></script>
<script src="${ctxPath}/static/modular/doctorLooked/customer_charge_info.js?v=20200718"></script>